function Scanner(){
    this.initScanner();
}

var _CONDITION_INITIAL = 0;
Scanner.prototype = {
    initScanner: function (){
        this.$text = '';
        this.$condition = _CONDITION_INITIAL;
        this.$tokenType = '';
    },
    setText: function (text){
        this.$text = text;
    },
    // todo: condition换成state. 记录每个token的开始和结束state.
    getCondition: function (){
        return this.$condition;
    },
    setCondition: function (condition){
        this.$condition = condition;
    },
    getTokenType: function (){
        return this.$tokenType;
    },
    charCodeAt: function (cursor){
        return cursor < this.$text.length ? this.$text.charCodeAt(cursor) : 10;
    },
    inferCondition: function (offset){
        return _CONDITION_INITIAL;
    },
    nextToken: function (cursor){
    }
};